package com.odt.outdoor.locations;

import com.baidu.location.BDLocation;
import com.baidu.location.BDLocationListener;

/**
 * Created by DELL on 2017/3/10.
 */

public class EcBDLocationListener implements BDLocationListener {
    private OnGetLoactionsLinstener onGetLoactionsLinstener;
    public EcBDLocationListener(OnGetLoactionsLinstener onGetLoactionsLinstener){
        if (onGetLoactionsLinstener!=null){
            this.onGetLoactionsLinstener = onGetLoactionsLinstener;
        }

    }
    @Override
    public void onReceiveLocation(BDLocation bdLocation) {
        if (null != bdLocation && bdLocation.getLocType() != BDLocation.TypeServerError){
            onGetLoactionsLinstener.onGetXY(String.valueOf(bdLocation.getLatitude()), String.valueOf(bdLocation.getLongitude()));
        }
    }

    @Override
    public void onConnectHotSpotMessage(String s, int i) {

    }

    public interface OnGetLoactionsLinstener{
        /**
         *
         * @param latitude 精度
         * @param longitude 纬度
         */
        void onGetXY(String latitude, String longitude);
    }
}
